package com.demo.shardingsphere.user.mapper;

import com.demo.shardingsphere.user.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;


@Mapper
public interface UserMapper {


    @Insert({"insert into t_user (`user_id`, `username`, `mobile_phone`, `create_time`) values (#{user.userId}, #{user.username}, #{user.mobilePhone}, #{user.createTime} )"})
    int insertUser(@Param("user") User user);


    @Select("select user_id as userId, username as username, mobile_phone as mobilePhone , create_time createTime from t_user where user_id  = #{userId}")
     User  queryUserById(Long userId);

    @Select("select user_id as userId, username as username, mobile_phone as mobilePhone , create_time createTime from t_user")
    List<User> queryUserList();
}
